/* Original Author:  Dominick O'Dierno
 * Date: 2007   odiernod@gmail.com     --Originally intended for use with DOMercury:  http://www.odierno.com/domercury
 * Description: Provides actions for a Current Window Item
 * 
 * --CHANGELOG--
 * 
 * */
using System;
using System.Collections.Generic;
using System.Text;
using ManagedWinapi;
using DOMercury.Interfaces;
using DOMercury.Items;

namespace DOMercury.Actions
{
    public class CWMaximize : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Maximize"; }
        }

        public string Description
        {
            get { return "Maximizes the Current Window"; }
        }

        public string ParamDescription
        {
            get { return "Unused"; }
        }

        public string ParameterType
        {
            get { return "Hwnd"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            return Win32.ShowWindow(((IntPtr)(specialParams)), (int)Win32.WindowShowLParam.ShowMaximized);
        }

        #endregion
    }

    public class CWMinimize : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Minimize"; }
        }

        public string Description
        {
            get { return "Minimizes the Current Window"; }
        }

        public string ParamDescription
        {
            get { return "Unused"; }
        }

        public string ParameterType
        {
            get { return "Hwnd"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            return Win32.ShowWindow(((IntPtr)(specialParams)), (int)Win32.WindowShowLParam.Minimize);
        }

        #endregion
    }

    public class CWClose : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Close"; }
        }

        public string Description
        {
            get { return "Closes Current Window"; }
        }

        public string ParamDescription
        {
            get { return "Unused"; }
        }

        public string ParameterType
        {
            get { return "Hwnd"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            Win32.SendMessage(((IntPtr)(specialParams)), (int)Win32.Msgs.WM_CLOSE, 0, 0);
            return true;
        }

        #endregion
    }

    public class CWRestore : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Restore"; }
        }

        public string Description
        {
            get { return "Restores the Current Window to its default size"; }
        }

        public string ParamDescription
        {
            get { return "Unused"; }
        }

        public string ParameterType
        {
            get { return "Hwnd"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            return Win32.ShowWindow(((IntPtr)(specialParams)), (int)Win32.WindowShowLParam.Restore);
        }

        #endregion
    }
}
